import request from '@/utils/request'

export default {
    tree() {
        return request({
            url: `/menu/tree`,
            method: 'get',
        })
    },

    add(user) {
        return request({
            url: `/menu/add`,
            method: 'post',
            data: user
        })
    },

    update(user) {
        return request({
            url: `/menu/update`,
            method: 'post',
            data: user
        })
    },

    removeById(id) {
        return request({
            url: `/menu/removeById/${id}`,
            method: 'delete',
        })
    },

    getByRoleId(id) {
        return request({
            url: `/role/getByRoleId/${id}`,
            method: 'get',
        })
    },

    // 为用户分配角色
    assignMenu(po) {
        return request({
            url: `/role/assignMenu`,
            method: 'post',
            data: po
        })
    },
}

